Module changes counter

We need to have a function to count the changes (deletions, modifications and creations) of one kind of object (kind is an object attribute), between baselines. Do you knows a .dxl for that?

We knows that it is possible to use a filter like (ObjKinf == Requirement AND Last Modified ON > 09 October 2012), but we have to repeat this action several times. One dxl for that operation would be good.

Regards,
Silveira
Silveirax - Mon Oct 29 15:28:35 EDT 2012

Re: Module changes counter
llandale - Mon Oct 29 16:19:18 EDT 2012

Your 1st sentance doesn't match your 2nd sentance.

2nd sentance: You should only have to filter a single time.

  • Filter flt = attribute "ObjKinf" == "Requirement" and attribute "Last Modified On" > "09 October 2012"
  • set(flt)


1st sentance: You are asking for how many changes; so if such an object is changed twice you want "2". You could filter for all your target Objects, then count History

 

  • History hst
  • int NumHist = 0
  • for hst in obj do {NumHist++}


One problem with this is that you do want to find all objects that have EVER been of the target kind (since baseline), not just those that are currently (i.e. find deleted objects or those that are no longer requirements). That is trickier. I would say you want objects...

 

 

  • That are requirements.
  • That have had their "Requirment" attribute changed
  • That have been deleted or purged and have been associated with Requirements.


I would guess that means:

 

 

  • Get a complete list of Objects associated with "Requirement"
    • Open the previous baseline and get a list of all AbsNos of objects that were Requirements at that baseline.
    • Look through the current module for each "Requirement".
    • Look through current Module history for any obj-attr value change to "Requirement", and remember the AbsNo for that object.
    • Combine the above 3 lists of AbsNos.
  • Look through Module history, get the AbsNo of the History record, and if it is in your list then increment the count of changes to that object.


Let me scribble to get you going on that:

 

 

Skip skpRequirement = create() // KEY both 'int' AbsNo of Objects that have ever been a Requirement
                      // DATA: 'int' Number of History for such an Object
Baseline bline
int iAbs, NumHist
for bline in mod do{}  // bline now points to the last baseline'
 
Module mBase = load(mod, bline)
// Was a Requirement:
for o in mBase do
{ if (o is a requirement) then {iAbs = o."Absolute Number"; put(skpRequirement, iAbs, 0)}
}
// Is a Requirement:
for o in mod do
{ if (o is a requirement) then {iAbs = o."Absolute Number"; put(skpRequirement, iAbs, 0)}
}
History hst
HistoryType ht
for hst in mod do
{ noError()
  NameAttr = hst.attrName
  // Object has had "Requirement" value changes:
  if (NameAttr is Requirement) then  { iAbs = hst.absNo;     put(skpRequirement, iAbs, 0)
  lastError()     // prevents history access errors
}
// skpRequriement now has complete list if Requirements.
// Now count History for each such Object:
for hst in mod do
{  noError()
   iAbs = hst.absNo
   if (iAbsHist <= 0) then continue    // History not for objects?
   if (!find(skpRequirement, iAbs, NumChanges)) then continue // Don't care about this Object's History
 
   NameAttr = hst.attrName
   if (NameAttr is Requirement) then
   {  delete(skpRequirement, iAbs)   // Remove old count
      put(skpRequirement, iAbs, NumChanges++)  // Insert new count
   }
   lastError()
}
// Now report:
for NumHist in skpRequirement do
{  iAbs = (int key skpRequirement)
   if (NumHist > 0) then print "Requirement #" iAbs "\tHas this many History since Baseline: " NumHist  "\n"
}


-Louie